package com.yonyou.cyxdms.basedata.service.service.code;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.service.base.ICommonService;
import com.yonyou.cyxdms.basedata.client.domains.vo.CodeVO;
import com.yonyou.cyxdms.basedata.client.domains.vo.DictVO;
import com.yonyou.cyxdms.basedata.client.dto.code.CodeDTO;
import com.yonyou.cyxdms.basedata.client.dto.code.SearchCodeDTO;
import com.yonyou.cyxdms.basedata.service.entity.code.CodePO;
import com.yonyou.cyxdms.framework.bean.dto.user_info.LoginInfoDto;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 系统固定代码 服务类
 * </p>
 *
 * @author renwd
 * @since 2018-12-12
 */
public interface CodeService extends ICommonService<CodeDTO, CodePO,Integer> {

    public List<CodeVO> getTcCodeByType(Map<String, Object> queryParam);

    public List<CodeVO> getTcCode(String appId);

    /**
     * 根据CODE名称查询codeID
     * @param codeName
     * @return
     */
    CodeVO getTcCodeByName(String codeName, Integer type);

    List<DictVO> allCode();

    List<DictVO> allCodeAvailable();

    /**
     * 根据type查询code
     *
     * @param type type
     * @return java.util.List<com.yonyou.cyx.base.bean.entity.CodePO>
     * @author renwd
     * @since 2018/11/22
     */
    public List<CodeVO> queryCode(String type);

    /**
     * 根据type获取下一次的主键ID
     * @param type
     * @return
     */
    public Integer getNextCodeId(Integer type, LoginInfoDto loginInfoDto);

    Map<String, Object> updateCodePo(CodeDTO codeDTO);

    Map<String,Object> insertCodePo(CodeDTO codeDTO);

    /**
     * 根据type获取下一次的NUM
     * @param type
     * @return
     */
    public Integer getNextNum(Integer type, LoginInfoDto loginInfoDto);


    Integer deleteByCodeId(Integer codeId);

    CodeVO queryById(Long id);

    /**
     * 根据codeId查询
     *
     * @param codeId
     * @param appId
     * @return com.yonyou.cyxdms.basedata.client.domains.vo.CodeVO
     * @author dengqiang
     * @since 2019/11/1
     */
    CodeVO queryByCodeId(Long codeId, String appId);


    /**
     * 分页查询字典项
     *
     * @author zhangjinyin
     * @since 2020/11/26
     */
    List<CodeDTO> queryList(Page page, SearchCodeDTO dto);

    /**
     * 获取全部类型
     *
     * @author zhangjinyin
     * @since 2020/11/26
     */
    List<CodeDTO> getAllCodeType(String typeName);

    /**
     * 根据id 获取 字典项
     *
     * @param codeId
     * @author zhangjinyin
     * @since 2020/11/26
     */
    CodeDTO getCodeById(Integer codeId);

    /**
     * 新增修改字典项
     *
     * @author zhangjinyin
     * @since 2020/11/26
     */
    Boolean saveCode(CodeDTO codeDTO);

    /**
     * 删除缓存中的字典户据
     */
    void refreshCode(String appId);
}
